package com.yoga.app.web;

import com.yoga.app.annotation.LoginUser;
import com.yoga.common.appexception.AppException;
import com.yoga.common.appexception.YogaResult;
import com.yoga.common.bo.CourseBO;
import com.yoga.common.bo.YogaUserBO;
import com.yoga.common.page.PageBO;
import com.yoga.common.qto.CourseQTO;
import com.yoga.manager.app.AppCourseManager;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Created by hdx on 2020/10/20.
 */
@RestController
@RequestMapping("${basePath}")
public class AppCourseController {

    @Resource
    private AppCourseManager courseManager;

    @PostMapping("/course/findForPage")
    public YogaResult<PageBO<CourseBO>> findForPage(@LoginUser YogaUserBO userBO, @RequestBody CourseQTO courseQTO) throws AppException {
        PageBO<CourseBO> pageBO = courseManager.findForPage(courseQTO);

        return new YogaResult<>(pageBO);
    }

}
